package components.especiales
{
	import com.system.ControlSystem;

	import mx.controls.Button;
	import mx.events.FlexEvent;

	public class BotonGenerico extends Button
	{
		private var _permiso:int = 0;
		private var _cancelar:Boolean = false;
		public function BotonGenerico()
		{
			super();
			addEventListener(FlexEvent.CREATION_COMPLETE,_init);
		}

		public function set permiso(permiso:int):void{
				this._permiso = permiso;
		}

		public function set cancelar(cancelar:Boolean):void{
			this._cancelar = cancelar;
		}

		private function _init(event:FlexEvent):void{
			if (_cancelar){
				visible = true;
			}else{
				if (ControlSystem.getInstancia().getPermisos(this._permiso)){
					visible = true;
				}else{
					visible = false;
				}
			}


		}


	}
}